<template>
  <div  class="shop-info">
      <!-- 头部 -->
    <div class="top">
      <img :src="shop.logo">
      <span class="name">{{shop.name}}</span>
    </div>
    <!-- 中部  -->
    <div class="middle">
      <div class="middle-item middle-left">
        <div class="info-sells">
          <div class="sells-count">
            {{shop.sells}}
          </div>
          <div class="sells-text">总销量</div>
        </div>
        <div class="info-goods">
          <div class="goods-count">
            {{shop.goodsCount}}
          </div>
          <div class="goods-text">全部宝贝</div>
        </div>
      </div>
      <div class="shop-middle-item middle-right">
        <table>
          <tr v-for="(item, index) in shop.score" :key="index">
            <td>{{item.name}}</td>
            <td class="score" :class="{'score-better': item.isBetter}">{{item.score}}</td>
            <td class="better" :class="{'better-more': item.isBetter}"><span>{{item.isBetter ? '高':'低'}}</span></td>
          </tr>
        </table>
      </div>
    </div>
    <!-- 底部 -->
    <div class="bottom">
      <div class="shop">进店逛逛</div>
    </div>
  </div>
</template>

<script>
export default {
  name:'shopInfo',
  props: {
      shop:{
        type:Object,
        default (){
          return {}
        }
      }
  }
}
</script>
<style scoped>
.shop-info {
    padding: 15px 8px;
    border-bottom: 5px solid #f2f5f8;
}
.top {
  display: flex;
  align-items: center;
}
.top>img {
  width: 16%;
  height: 16%;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.1);
}
.top>.name {
  margin-left: 10px;
  color: rgb(44, 44, 44);
  font-size: 16px;
  /* 
  width: 25%;
  text-overflow:ellipsis;
  white-space:nowrap;	
  overflow:hidden; 
  */
}
/* === */
.middle {
    margin-top: 15px;
    display: flex;
    align-items: center;
}
.middle-item {
    flex: 1;
  }
.middle-left {
    display: flex;
    justify-content: space-evenly;
    color: #333;
    text-align: center;
    border-right: 1px solid rgba(0,0,0,.1);
  }
   .sells-count, .goods-count {
    font-size: 18px;
  }

  .sells-text, .goods-text {
    margin-top: 10px;
    font-size: 12px;
  }
  .middle-right {
    font-size: 13px;
    color: #333;
  }

  .middle-right table {
    width: 120px;
    margin-left: 30px;
  }

  .middle-right table td {
    padding: 5px 0;
  }

  .middle-right .score {
    color: #5ea732;
  }

  .middle-right .score-better {
    color: #f13e3a;
  }

  .middle-right .better span {
    background-color: #5ea732;
    color: #fff;
    text-align: center;
  }

  .middle-right .better-more span {
    background-color: #f13e3a;
  }
/* -== */
.bottom {
  text-align: center;
  margin-top: 10px;
}
.bottom>.shop {
  display: inline-block;
  font-size: 14px;
  background-color: #f2f5f8;
  width: 150px;
  height: 30px;
  text-align: center;
  line-height: 30px;
  border-radius: 10px;
}
</style>
